<div class="add-subcat">
    <form id="form1" class="layui-form layui-form-pane" action="/education/admin/menu/save">
        <div class="layui-form-item">
            <label class="layui-form-label">上级部门</label>
            <div class="layui-input-inline">
                <input type="hidden" name="parentmenuids" >
                <input type="text" name="parentname" class="layui-input" readonly>
            </div>
            <a class="layui-btn" onclick="beforeChoice();">
                <i class="iconfont">&#xe649;</i> 选择
            </a>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-block">
                <input type="text" name="names_zhcn" required jq-verify="required" jq-error="请输入名称"
                       class="layui-input ">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">权限</label>
            <div class="layui-input-block">
                <!--<input type="text" name="operatorids" required jq-verify="required" jq-error="权限" class="layui-input ">-->
                <select name="operatorids" id="operatorids">
                    <option value="">请选择</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">图标</label>
            <div class="layui-input-inline">
                <input type="text" name="icon" required jq-verify="required" jq-error="图标" class="layui-input ">
            </div>
            <a class="layui-btn" onclick="viewIcon();">
                <i class="iconfont">&#xe605;</i> 查看
            </a>
            请复制相应图标编码
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-block">
                <input type="number" name="orderids" required jq-verify="number" jq-error="排序必须为数字"
                       class="layui-input ">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
                <input type="radio" name="disable" title="启用" value="0" checked />
                <input type="radio" name="disable" title="禁用" value="1" />
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" jq-submit jq-filter="submit">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    function choiceDept(item){
        var $ = layui.jquery;
        $('input[name="parentmenuids"]').val(item.id);
        $('input[name="parentname"]').val(item.name);
    }

    function beforeChoice(){
        var index = layer.open({
            type: 2,
            content: "menu-tree.html", "title": "选择部门", "area": ['500px', '600px'], "maxmin":"true"
        });
    }

    function initSelect() {
        layui.use('jquery', function () {
            var $ = layui.jquery;
            $(function () {
                var arr = ['<option value="">请选择</option>'];
                $.ajax({
                    dataType:'json',
                    method:'post',
                    url: '/education/admin/operator',
                    data: {'_query.mids': '1230ce23374a457aace0b5db41ede6e8', 'pageSize':100},
                    async: false,
                    success: function (rs) {
                        if (rs.status == 200) {
                            $.each(rs.data.list, function (i, n) {
                                var v ='<option value={v}>{n}[{url}]</option>'
                                        .replace('{v}', n.ids).replace('{n}', n.names)
                                        .replace('{url}', n.url);
                                arr.push(v);
                            })
                        }
                        $('#operatorids').html(arr.join(''));
                    }
                });
            })
        });
    }

    function viewIcon(){
        window.open('../css/font/icon_unicode.html');
    }
</script>